package thread;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * 定时器
 */
public class Class_Timer {
    public static void main(String[] args) {
        /*
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println();
            }
        },new Date(System.currentTimeMillis() - 5000),1000);
    }
         */
        Mytimer mytimer = new Mytimer();
        mytimer.schedule(new MyTask(()->{
            System.out.println("执行任务");
        },5000));
    }
}
